
//
//  LGOrderMultipleCell.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/7/23.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "LGOrderMultipleCell.h"
#import "OrderListModel.h"
@interface LGOrderMultipleCell()
@property (weak, nonatomic) IBOutlet UILabel *goodsNumberLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imgV1;
@property (weak, nonatomic) IBOutlet UIImageView *imgV2;
@property (weak, nonatomic) IBOutlet UIImageView *imgV3;

@end
@implementation LGOrderMultipleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setupOrderData:(id)data{
    OrderModel * model = data;
  
    self.goodsNumberLabel.text = [NSString stringWithFormat:@"共计 %ld 件",[model.goods_item count]];
    for (int i = 0;i< [model.goods_item count];i++) {
        GoodsModel * goodsModel =  model.goods_item[i];
        if (i == 0) {
            if (goodsModel.goods_img) {
                [self.imgV1 yy_setImageWithURL:[NSURL URLWithString:goodsModel.goods_img] placeholder:nil];
            }
            if (goodsModel.cate_img) {
                [self.imgV1 yy_setImageWithURL:[NSURL URLWithString:goodsModel.cate_img] placeholder:nil];
            }
            if (goodsModel.img_list && [goodsModel.img_list count] > 0) {
                [self.imgV1 yy_setImageWithURL:[NSURL URLWithString:goodsModel.img_list.firstObject] placeholder:nil];
            }
            
        }else if (i == 1){
            if (goodsModel.goods_img) {
                [self.imgV2 yy_setImageWithURL:[NSURL URLWithString:goodsModel.goods_img] placeholder:nil];
            }
            if (goodsModel.cate_img) {
                [self.imgV2 yy_setImageWithURL:[NSURL URLWithString:goodsModel.cate_img] placeholder:nil];
            }
            if (goodsModel.img_list && [goodsModel.img_list count] > 0) {
                [self.imgV2 yy_setImageWithURL:[NSURL URLWithString:goodsModel.img_list.firstObject] placeholder:nil];
            }
            
        }else if (i == 2){
            if (goodsModel.goods_img) {
                [self.imgV3 yy_setImageWithURL:[NSURL URLWithString:goodsModel.goods_img] placeholder:nil];
            }
            if (goodsModel.cate_img) {
                [self.imgV3 yy_setImageWithURL:[NSURL URLWithString:goodsModel.cate_img] placeholder:nil];
            }
            if (goodsModel.img_list && [goodsModel.img_list count] > 0) {
                [self.imgV3 yy_setImageWithURL:[NSURL URLWithString:goodsModel.img_list.firstObject] placeholder:nil];
            }
        }
      
    }
    if ([model.goods_item count] ==2) {
        self.imgV3.hidden = YES;
    }else{
        self.imgV3.hidden = NO;
    }
}
@end
